:root {
    --primary-color: #4a6fa5;
    --secondary-color: #6b8e23;
    --accent-color: #ff6b6b;
    --bg-color: #f8f9fa;
    --text-color: #333;
    --card-bg: #fff;
    --border-color: #dee2e6;
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    padding: 20px;
    z-index: 1;
}

/* 背景样式 */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: url('../assets/map.png');
    background-size: cover; /* 调整为 cover 以填充整个容器 */
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(4px); /* 添加模糊效果 */
    opacity: 0.3; /* 增加透明度以减少干扰 */
}

/* 渐变叠加层 */
.gradient-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(74, 111, 165, 0.5), rgba(107, 142, 35, 0.5), rgba(255, 107, 107, 0.5));
    z-index: -1;
    mix-blend-mode: overlay; /* 添加混合模式以增强视觉效果 */
}

/* API Key 设置页面 */
.api-key-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

.api-key-form {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 500px;
}

.api-key-form h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.1);
}

.btn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.btn:hover {
    background-color: #3a5a80;
    transform: translateY(-2px);
}

.info-text {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

.info-text a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.info-text a:hover {
    text-decoration: underline;
}

/* 主聊天界面 */
.chat-container {
    display: none;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.chat-header {
    background: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h1 {
    font-size: 24px;
    font-weight: 600;
}

.chat-header .api-key-info {
    font-size: 14px;
    opacity: 0.8;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
}

.message {
    max-width: 80%;
    padding: 15px;
    border-radius: 12px;
    position: relative;
    animation: fadeIn 0.3s ease;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    align-self: flex-end;
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message {
    align-self: flex-start;
    background-color: #e9ecef;
    border-bottom-left-radius: 4px;
}

.message-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin-top: 10px;
    object-fit: contain;
}

.chat-input {
    display: flex;
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background: #f8f9fa;
    gap: 10px;
}

.input-area {
    flex: 1;
    display: flex;
    gap: 10px;
}

.text-input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    resize: none;
    transition: var(--transition);
    min-height: 44px;          /* 至少一行 */
    max-height: 30vh;          /* 最多占视口高度的 30% */
    overflow-y: hidden;        /* 未达上限时隐藏滚动条，由 JS 控制切换 */
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.1);
}

.upload-btn {
    padding: 12px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    display: none;
}

.upload-btn:hover {
    background-color: #5a7d1c;
    transform: translateY(-2px);
}

.send-btn {
    padding: 12px 20px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.send-btn:hover {
    background-color: #ff5252;
    transform: translateY(-2px);
}

.file-input {
    display: none;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: var(--primary-color);
    font-weight: 600;
}

.welcome-message {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 18px;
    line-height: 1.8;
}

/* 顶部主题导航 */
.top-tabs {
    display: flex;
    gap: 10px;
    margin: 10px 0 14px;
    flex-wrap: wrap;
}
.nav-tab {
    border: 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(255,255,255,0.55);
    color: #222;
    backdrop-filter: blur(6px);
    cursor: pointer;
    transition: transform .1s ease, background .2s ease, box-shadow .2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.nav-tab:hover { transform: translateY(-1px); }
.nav-tab.active {
    background: linear-gradient(135deg,#7bd6ff,#8bc3ff,#b39dff);
    color: #fff;
    box-shadow: 0 6px 18px rgba(123,214,255,0.35);
}

/* 面板容器 */
.page-panel { display: none; }
.page-panel.active { display: block; }

/* 面板头部介绍 */
.page-hero {
    background: linear-gradient(135deg, rgba(123,214,255,0.18), rgba(179,157,255,0.18));
    border: 1px solid rgba(123,214,255,0.35);
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 12px;
    color: #234;
}

/* 建议卡片 */
.suggestion-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.suggestion-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: box-shadow .2s ease, transform .1s ease;
    line-height: 1.4;
}
.suggestion-card:hover {
    box-shadow: 0 8px 18px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

/* 历史上的今天动作区 */
.today-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0 12px;
}
.today-actions .btn.primary {
    background: linear-gradient(135deg,#ffb27b,#ffa77b);
    color: #fff;
    border: 0;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(255,167,123,0.35);
}
.today-actions .hint { color: #666; }

.suggestion-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.suggestion-card {
    background: var(--card-bg);
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
    min-width: 200px;
    text-align: center;
}

.suggestion-card:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* 省份选项卡样式 */
.province-tabs {
    margin: 20px 0;
    text-align: center;
}

.province-tabs h3 {
    margin-bottom: 10px;
    font-size: 18px;
    color: var(--primary-color);
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.tab {
    padding: 10px 20px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.tab:hover {
    background: #5a7d1c;
    transform: translateY(-2px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-header h1 {
        font-size: 20px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .chat-input {
        flex-direction: column;
    }
    
    .input-area {
        flex-direction: column;
    }
    
    .suggestion-card {
        min-width: 100%;
    }
}

/* 图片预览样式 */
.image-preview {
    max-width: 100px;
    max-height: 100px;
    border-radius: 8px;
    object-fit: cover;
    margin-left: 10px;
    cursor: pointer;
}

.image-preview-container {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.remove-image {
    margin-left: 5px;
    cursor: pointer;
    color: #dc3545;
    font-weight: bold;
}

.remove-image:hover {
    color: #c82333;
}

/* 加载动画 */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.typing-indicator {
    display: none;
    align-self: flex-start;
    background: #e9ecef;
    padding: 12px 15px;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dot {
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1.0);
    }
}

/* 错误消息样式 */
.error-message {
    background: #dc3545;
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    text-align: center;
}

.retry-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 10px;
    font-size: 14px;
}

.retry-btn:hover {
    background: #5a6268;
}

/* 人物实例卡片样式 */
.figure-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 8px;
}
.figure-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow .2s ease, transform .1s ease;
}
.figure-card:hover {
    box-shadow: 0 8px 18px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.figure-card img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
}
.figure-body { padding: 10px 12px; }
.figure-title { font-weight: 700; color: #234; }
.figure-brief { font-size: 14px; color: #555; margin-top: 4px; }


